<!--  初始化判断当前是否登录   -->
$(function () {
    $.ajax({
        type: 'post',
        url: '/admin/loginAdmin',
        success: function (adminJSON) {
            if (adminJSON == 0) {
                layui.layer.msg('请登录！',{icon:0,time:1000,end:function () {
                        location.href='login.html';
                    }});
                return;
            }
            //存储管理员Id、name，用户数据回显查询
            sessionStorage.setItem("aId",adminJSON.id);
            sessionStorage.setItem("name",adminJSON.name);
            // 将登录用户名回显
            var name = adminJSON.name;
            $("#admin").html(name);
            return;
        },
        error: function () {
            return;
        }
    });
});
function destroyLogin() {
    $.get('/admin/destroyLogin',{},function (data) {
        if (data == 1) {
            location.href='login.html';
            return;
        }
        layui.layer.msg('退出失败，请稍后重试！',{icon:0,time:1000});
        return;
    })

}